package com.egao.common.module.company.utils;

import com.egao.common.core.web.PageParam;
import com.egao.common.module.company.constants.CompanyConstants;

/**
 * 单位工具类
 * @author dl
 */
public class CompanyUtil {

    /**
     * 添加申请时间查询条件
     * @param page 分页对象
     * @return PageParam 结果对象
     */
    public static PageParam<?> putApplyTime(PageParam<?> page) {
        //申请时间
        if (page.getPageData().get(CompanyConstants.APPLY_TIME) != null) {
            String[] arr = page.getPageData().get(CompanyConstants.APPLY_TIME).toString().split("~");
            if (arr.length > 0) {
                page.put("createTimeStart", arr[0] + " 00:00:00");
            }
            if (arr.length > 1) {
                page.put("createTimeEnd", arr[1] + " 23:59:59");
            }
        }
        return page;
    }

    public static PageParam<?> putHoldTime(PageParam<?> page) {
        //申请时间
        if (page.getPageData().get(CompanyConstants.HOLD_TIME) != null) {
            String[] arr = page.getPageData().get(CompanyConstants.HOLD_TIME).toString().split("~");
            if (arr.length > 0) {
                page.put("selectTimeStart", arr[0] + " 00:00:00");
            }
            if (arr.length > 1) {
                page.put("selectTimeEnd", arr[1] + " 23:59:59");
            }
        }
        return page;
    }
}
